/*
 * @Author: Penk
 * @LastEditors: Penk
 * @LastEditTime: 2021-05-02 15:00:31
 * @FilePath: \temp\多多插件\js\back.js
 */
let data = {};


function back() {
  chrome.tabs.getSelected(null, function (tab) {
    var title = tab.title;
    chrome.tabs.executeScript(null, {
      // code: '$("#kw").value = "test";$("#s_btn_wr").click();'
      code: 'javascript:alert("' + title + '")'
    });
  })
}

function init() {

}

// 监听消息
chrome.runtime.onMessage.addListener(async function (request, sender, sendResponse) {
  // code...
  await getPdd(url);

  sendResponse('返回拼多多的数据包：' + data); //做出回应
});

function getPdd(url) {
  return new Promise((resolve, reject) => {

    setTimeout(() => {
      resolve();
    }, 1000);
  })
}